Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): use correct type definitions for createNativeLocaleFormatter… #440

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

ptoal
Copy link
Contributor

@ptoal ptoal commented May 11, 2024

This addresses typescript compiling errors when using the createNativeLocaleFormatter function per the examples in the documentation. The return type of this function is a function, not a string.

Tested this fix on my project, which uses the following snippets of code (taken from docs/src/examples/DayCustomHeader.vue):

<div style="width: 100%; font-size: 0.9em">
   {{ monthFormatter(day, true) }}
</div>
const  monthFormatter = monthFormatterFunc(),

function monthFormatterFunc() {
  const longOptions: Intl.DateTimeFormatOptions = {
    timeZone: 'UTC',
    month: 'long',
  };
  const shortOptions: Intl.DateTimeFormatOptions = {
    timeZone: 'UTC',
    month: 'short',
  };

  return createNativeLocaleFormatter(locale.value, (_tms, short) =>
    short ? shortOptions : longOptions
  );
}```
… (#439)

@hawkeye64 hawkeye64 merged commit 67ef2b7 into quasarframework:next Jan 10, 2025
4 checks passed
@hawkeye64
Copy link
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants